package com.example.routeplansystem.constant;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author lucong
 * @Date 2022/8/10
 * @Description
 */

@Data
@NoArgsConstructor
public class PageRes<T> {
    private int pageNum;
    private int pageSize;
    private List<T> records;
    private long total;

    public PageRes(PageInfo<T> page) {
        this.pageNum = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.records = page.getList();
        this.total = page.getTotal();
    }

    public PageRes(Page<T> page) {
        this.pageNum = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.records = page;
        this.total = page.getTotal();
    }
}
